@function pi() {
  @return 3.14159265358979;
}
@function tau() {
  @return 6.28318530717959;
}
@function rad($angle) {
  $unit: unit($angle);
  $unitless: calc($angle / ($angle * 0 + 1));
  @if $unit == "deg" {
    $unitless: $angle * (pi() / 180);
  }
  @return $unitless;
}
@function deg($angle) {
  @return $angle * (180 / pi());
}
@function percent($value) {
  @if type-of($value) != "number" {
    @error 'Expected number, got `#{$value}`.';
  }
  @return percentage(calc($value / 100));
}
@function clamp($min, $value, $max) {
  @return max($min, min($value, $max));
}
@function rem($value) {
  @return $value / 16 * 1rem;
}
@function pow($base, $exp) {
  $value: $base;
  @for $i from 2 through $exp {
    $value: $value * $base;
  }
  @if $exp < 0 {
    @for $i from 0 through -$exp {
      $value: $value / $base;
    }
  }
  @return $value;
}
@function fact($num) {
  $fact: 1;
  @if $num > 0 {
    @for $i from 1 through $num {
      $fact: $fact * $i;
    }
  }
  @return $fact;
}
@function cos($angle) {
  $cos: 0;
  $angle: rad($angle);
  @for $i from 0 through 10 {
    $cos: $cos + pow(-1, $i) * calc(pow($angle, 2 * $i) / fact(2 * $i));
  }
  @return $cos;
}
@function sin($angle) {
  $sin: 0;
  $angle: rad($angle);
  @for $i from 0 through 10 {
    $sin: $sin + pow(-1, $i) * calc(pow($angle, 2 * $i + 1) / fact(2 * $i + 1));
  }
  @return $sin;
}
